﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Lib
{
    public class CommonUtil
    {
        public static Boolean isDelete()
        {
            if (showAskMessageBox("是否删除当前选中数据？"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static void showMessageBox(string strInfo)
        {
            MessageBox.Show(strInfo, "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static void showErrorMessageBox(string strInfo)
        {
            MessageBox.Show("消息：" + strInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        public static bool showAskMessageBox(string strInfo)
        {
            if (MessageBox.Show(strInfo, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                return true;
            }
            return false;
        }

        public static bool showAskMessageBoxOC(string strInfo)
        {
            if (MessageBox.Show(strInfo, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                return true;
            }
            return false;
        }

        public static bool checkDataSet(DataSet ds)
        {
            if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
